
package com.starshineworks.util.actions;

import com.starshineworks.entities.EntityE;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Action {
    
    public static Action createAction(String act) 
    {        
        EntityE.initAll();
        
        if (act.equalsIgnoreCase("Register")) {
            return (new ActionRegister());
        }

        if (act.equalsIgnoreCase("Login")) {
            return (new ActionLogin());
        }
                
        if (act.equalsIgnoreCase("Logout")) {
            return (new ActionLogout());
        }

        if (act.equalsIgnoreCase("Info")) {
            return (new ActionInfo());
        }

        if (act.equalsIgnoreCase("Delete")) {
            return (new ActionDelete());
        }

        /* XXX if (act.equalsIgnoreCase("TeamPage")) {
            return (new ActionTeamPage());
        }*/

        if (act.equalsIgnoreCase("CreateTeam")) {
            return (new ActionCreateTeam());
        }

        if (act.equalsIgnoreCase("CreateField")) {
            return (new ActionCreateField());
        }

        if (act.equalsIgnoreCase("SubmitRequest")) {
            return (new ActionSubmitRequest());
        }

        return null;
    }

    /* XXX
    public boolean perform(HttpServletRequest  request, 
                           HttpServlet         serv, 
                           boolean isMultiPart) 
    {
        return perform(request, null, serv, isMultiPart);
    }*/

    public boolean perform(HttpServletRequest  request, 
                           HttpServletResponse response, 
                           HttpServlet         serv, 
                           boolean isMultiPart) 
    {
        return false;
    }
    
    public String getNextPage() 
    {
        return null;
    }

    public String getError() 
    {
        return null;
    }
}
